//
//  eightTableViewCollectionViewCell.m
//  微运营
//
//  Created by 李光耀 on 16/3/22.
//  Copyright © 2016年 李光耀. All rights reserved.
//

#import "eightTableViewCollectionViewCell.h"

@implementation eightTableViewCollectionViewCell


-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.label = [[UILabel alloc] initWithFrame:CGRectZero];
        self.picimageView = [[UIImageView alloc]initWithFrame:CGRectZero];
        self.button = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.button addTarget:self action:@selector(buttonPress:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:self.label];
        [self addSubview:self.button];
        [self addSubview:self.picimageView];
    }
    return self;
}

-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes{
    
    _button.frame = CGRectMake(15, 10, self.bounds.size.width-30, self.bounds.size.height/5*3);
    //    _button.backgroundColor = [UIColor redColor];
    self.label.frame = CGRectMake(15,self.bounds.size.height/5*3 +10, self.bounds.size.width-30, self.bounds.size.height/5*2);
    self.label.font = [UIFont systemFontOfSize:12];
    self.label.textAlignment = YES;
    self.picimageView.frame = CGRectMake(15, 10, self.bounds.size.width-30, self.bounds.size.height/5*3);
    self.picimageView.contentMode = UIViewContentModeScaleAspectFill;
    self.picimageView.layer.cornerRadius = (self.bounds.size.width - 30) / 2;
    self.picimageView.layer.masksToBounds = YES;
}

-(void)buttonPress:(UIButton *)sender{
    NSLog(@"点击了");
}


@end
